//
//  MessageController.m
//  mangoClient
//
//  Created by dazhou on 16/5/21.
//  Copyright © 2016年 dazhou. All rights reserved.
//

#import "MessageController.h"

@interface MessageController ()<UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *mTableView;
@property (nonatomic, strong) NSMutableArray * dataArr;

@end

@implementation MessageController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = @"消息";
    NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
    NSArray *messageArray = [userDefault valueForKey:@"bdpushmessageinfoArray"];
    self.dataArr = [[NSMutableArray alloc] init];
    if (messageArray && messageArray.count > 0) {
        [self.dataArr addObjectsFromArray:messageArray];
    }
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 94;
}

#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArr.count;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString * cellId = @"MessageListCell";
    
    MessageListCell * cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"MessageListCell" owner:nil options:nil] firstObject];
    }
    NSDictionary *dic = [self.dataArr objectAtIndex:indexPath.row];
    [cell initCell:dic];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
